<template>
	<a-row>
		<a-tabs defaultActiveKey="1"  >
	      <a-tab-pane tab="用户表单信息" key="1"></a-tab-pane> 
	    </a-tabs>
		<table  class='financing_audit'>
			<tr>
				<td  width="200"  align='right'>项目名称：</td>
				<td  >{{formData.name}}</td> 
			</tr>
			<tr>
				<td  width="200"  align='right'>资金规模（万元）：</td>
				<td>{{formData.size}}</td> 
			</tr>
			<tr>
				<td  width="200"  align='right'>投资周期（月）：</td>
				<td>{{formData.investmentCycle}}</td> 
			</tr>
			<tr>
				<td  width="200"  align='right'>最低期望利率（年化%）：</td>
				<td>{{formData.expectRateMin}}</td> 
			</tr>
			<tr>
				<td  width="200"  align='right'>最高期望利率（年化%）：</td>
				<td>{{formData.expectRateMax}}</td>  
			</tr>
			<tr>
				<td  width="200"  align='right'  class='align-text-top'>意向资产类别：</td>
				<td>{{formData.type | propertyType}} </td> 
			</tr>
			<tr>
				<td  width="200"  align='right'  class='align-text-top'>募集路径：</td>
				<td>{{formData.collectionAmtType | collectionAmtType}} </td> 
			</tr>
			<tr>
				<td  width="200"  align='right'  class='align-text-top'>其他要求：</td>
				<td ><span  v-html='formData.remark'  class=' word-break-all'></span></td> 
			</tr>
			<tr>
				<td  width="200"  align='right'>联系人：</td>
				<td>{{formData.contact}}</td> 
			</tr>
			<tr>
				<td  width="200"  align='right'>联系电话：</td>
				<td>{{formData.phone}}</td> 
			</tr>
			<tr>
				<td  width="200"  align='right'>联系邮箱：</td>
				<td>{{formData.email}}</td> 
			</tr>
		</table>
		<a-tabs defaultActiveKey="1"  >
	      <a-tab-pane tab="审核" key="1"></a-tab-pane> 
	    </a-tabs>
	    <a-form   :layout="formLayout"
	          id="components-form-demo-normal-login"
	          :form="form"
	          class="login-form"
	          @submit="handleSubmit"
	        >
	         
		     <a-form-item
		        label="审核意见"
		        :label-col="formItemLayout.labelCol"
		        :wrapper-col="formItemLayout.wrapperCol"
		      >
		           <a-textarea  v-decorator="['auditOpinion']"  rows='5'/>
		    </a-form-item> 
		    <a-form-item
		        label="审核结果"
		        :label-col="formItemLayout.labelCol"
		        :wrapper-col="formItemLayout.wrapperCol"
		      > 
					<a-radio-group  v-decorator="['status',baseform.status]">
					    <a-radio :value="2">通过</a-radio>
					    <a-radio :value="3">不通过</a-radio>
					</a-radio-group>
		    </a-form-item> 
		    <a-form-item  style='display: none;'>
		    	<a-input   v-decorator="['code',baseform.code]"  />
		    </a-form-item>
		    <a-form-item
				:wrapper-col="buttonItemLayout.wrapperCol"
			>
				<a-button type="primary"  html-type="submit"  class='mr20'>
					提交
				</a-button>
				 
				<a-button @click='back_common()'> 取消 </a-button> 
			</a-form-item>
	    </a-form>
	</a-row>
</template>

<script >
	import {  getPurchaseDetail,Audit_purchase  }  from '@/api/customer/index'
	export default {
		name:'purchase_audit',
		data(){
			return {
				/*form  布局*/
      			formLayout:'horizontal',
      			 
      			baseform:{
      				code:{initialValue:''},
      				status:{rules:[{required:true,message:'请选择审核结果'}]},
      			},
      			formData:{},
			}
		},
		beforeCreate () {
		    this.form = this.$form.createForm(this);
		  },

		created(){
			let code = this.$route.query.code
			this.baseform.code.initialValue = code
			this.pageInit(code)
		},
		methods:{
			pageInit(code){
				getPurchaseDetail(code).then((res)=>{
					if(res.data.flag == true){
						this.formData = res.data.data
					}
				})
			},
			/*提交表单*/
			handleSubmit (e) {
				let that = this,url
				e.preventDefault();
				// console.log(this.form.getFieldsValue())
				this.form.validateFields((err, values) => {
					if (!err) {
					  console.log('Received values of form: ', values);
					  values.auditOpinion = this.strSpace_to_save(values.auditOpinion)
					  Audit_purchase(values).then((res)=>{
					  	if(res.data.flag == true){ 
					  		that.$message.success(res.data.msg)
					  		that.$router.push('/customer/purchase')
					  	}
					  })
					}

				})
			}
		},
		computed: {
			formItemLayout () {
				const { formLayout } = this;
				return formLayout === 'horizontal' ? {
				labelCol: {md:{span:5},lg:{ span: 7 }},  //label 标签布局
				wrapperCol: {xxl:{ span: 8 },xl:{ span : 11},lg:{ span :14 },md:{ span : 16 },xs:{ span :24}}, //需要为输入控件设置布局样式时，使用该属性，用法同 labelCol
				} : {};
			},
			buttonItemLayout () {
				const { formLayout } = this;
				return formLayout === 'horizontal' ? {
				wrapperCol: { span: 14, offset: 7 },
				} : {};
			},
			
		},
	}
</script>

<style scoped="scoped">
.financing_audit tr{line-height: 3;}
</style>